package model.solver;

/**
 * Represent a type of solver.
 * 
 * @author GRONOWSKI Stephane svan001@aol.com
 * 
 *         igsat 2010
 * 
 */
public enum ESolver {
	UNKNOW ("Solver", "UNKNOW"), MINISAT ("Minisat", "Minisat"), RSAT ("RSat", "RSat");


	private String	description;
	private String	xmlValue;

	private ESolver(String description, String xmlValue) {
		this.description = description;
		this.xmlValue = xmlValue;
	}

	/**
	 * Return the description of the solver.
	 * 
	 * @return the description of the solver.
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Return the xmlValue, value that is supposed to written in the xml exportation.
	 * 
	 * @return the xmlValue
	 */
	public String getXmlValue() {
		return xmlValue;
	}

	/**
	 * Return the {@link ESolver} associate to a value find in a XML exportation.
	 * 
	 * @param value
	 *            xml value
	 * @return the associate {@link ESolver}
	 */
	public static ESolver getValueFromXML(String value) {
		for (ESolver sol : values())
			if (sol.getXmlValue().equals(value))
				return sol;
		return null;
	}
}
